#include <stdio.h>
int main( )
{
	int k, j, i, temp;
	int nums[10] = {12, 56, 489, 78, 123, 6, 89, 8899, 5, 664};
	printf("%-20s", "Before sorting: ");
	for (k = 0; k < 10; k++)
	{
		printf("%d ", nums[k]);
	}
	for (i = 0; i <=9; i++)         //外层循环
		for (j = 0; j < 9; j++) //内层循环
		{
			if (nums[j] > nums[j+1])      //比较大小
			{
				temp = nums[j];
				nums[j] = nums[j+1];
				nums[j+1] = temp;
			}                                   //互换
		}
	printf("%-20s", "\nAfter sorting:");
	for (k = 0; k < 10; k++)                    //输出排序后的数列
		printf("%d ", nums[k]);
	printf("\n");
	return 0;
}

